//
//  main.m
//  xchat mobile
//
//  Created by Matthew McGowan on 2/20/09.
//  Copyright  MST Mobile Inc 2009. All rights reserved.
//

#import <UIKit/UIKit.h>
@class UIImageView;
@interface MainWindow : UIViewController {
	UIImageView *contentView;
}
@end 

@implementation MainWindow
- (id)init {
	if(self = [super init]) {
		self.title = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
	}
	return self;
}
- (void)loadView {
	//load an app image and set it as primary view
	contentView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
	[contentView setImage:[UIImage imageNamed:@"Xchat.png"]];

	//Provide support for auto-rotation and resizing
	//contentView.autoresizeSubViews = YES;
	contentView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
	
	//Assign the view to a controller
	self.view = contentView;
	[contentView release]; //reduce the retain count by one
}

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
	return YES;
}
-(void) dealloc {
	[contentView release];
	[super dealloc];
}
@end
@interface xchat_mobileAppDelegate : NSObject <UIApplicationDelegate> {
}
@end

@implementation xchat_mobileAppDelegate

// On launch, create a basic window
- (void)applicationDidFinishLaunching:(UIApplication *)application {	
	UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
	UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[MainWindow alloc] init]];
	[window addSubview:nav.view];
	[window makeKeyAndVisible];
}

- (void)applicationWillTerminate:(UIApplication *)application  {
	// handle any final state matters here
}

- (void)dealloc {
	[super dealloc];
}

@end



int main(int argc, char *argv[]) {
    
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}
